//
//  UMVerifyManager.swift
//  umeng_vertify
//
//  Created by yunxi on 2021/8/26.
//

import Foundation
//import Flutter
//import UMVerify
//import UM

class UMVerfityManager : NSObject{
    
    static let umVerifySecret = "croKFU+hKyhtT6O/YgxroShs72HdbkKFyjwPFE3GrxuChG65GZL9MsFM+OXR1/RA1NdA4mflqsuQ/t2KVWT6/ZhD2n45owKdz/A362BFjbb8wXu9GUSzIHJhLl1KVY99UudJ6BJbe9AFSyEUJJVl41kYyFAwgK6oXP0yXv7PXtAHUvkPwWHemj79epfhF3ASW1OEKP076VOSlFJdMDURZNSEQpXyX0IRcKaMHCWvGjyDFO9N9xl53t0lS3+gQMFiq/ljcr1W4fRdnt+kEjVoUtxAj4L8opxY"
    
    
    static func methodCheck(call: FlutterMethodCall, result: @escaping FlutterResult) -> Bool {
        print("到这里")
        switch(call.method){
        case MethodName.initHelper:
            MethodHandler.initUMCommon()
            result("")
            break;
        case MethodName.setAuthSDKInfo:
            MethodHandler.setVerifySDKInfo(secret: umVerifySecret) { (resultDic) in
                result(["errorCode":1,])
            }
            break;
        case MethodName.checkEnvAvailable:do {
            let params = call.arguments as? [String : Int]

            MethodHandler.checkEnvAvailable(type: UMPNSAuthType(rawValue: params?["type"] ?? 2) ?? UMPNSAuthType.loginToken){ (resultDic) in
                
                result(["errorCode":1])
            }
            
            result("")
        }
            break;
        case MethodName.setLoggerEnable:
            break;
        case MethodName.getVerifyToken:
            break;
        case MethodName.accelerateLoginPage:
            break;
        case MethodName.getLoginToken:do {
            let params = call.arguments as? [String : Any]
            
            MethodHandler.getLoginTokenWithTimeout(timeOut: params?["timeOut"] as! TimeInterval)
            
            result("")
        }
            break;
        case MethodName.quitLoginPage:
            break;
        case MethodName.hideLoginLoading:
            break;
        case MethodName.addAuthRegisterXmlConfig:
            break;
        default:
            break;
        }
        return false;
    }
}

